package com.pan.alg.structure;

import com.pan.seed.Jone;

import java.util.*;
import java.util.concurrent.*;

public class CollectionDemo {

    /**
     * list
     */
    List<String> list1 = new ArrayList<>(16);
    List<String> list2 = new LinkedList<>();
    List<String> list3 = new Vector<>();
    List<String> list4 = new Stack<>();
    /**
     * set
     */
    Set<String> set1 = new HashSet<>(16);
    Set<String> set2 = new LinkedHashSet<>(16);
    Set<String> set3 = new TreeSet<>();
    Set<String> set4 = new CopyOnWriteArraySet<>();
    Set<String> set5 = new ConcurrentSkipListSet<>();

    /**
     * queue
     */
    Queue<String> queue1 = new ArrayDeque<>(16);
    Queue<String> queue2= new ArrayBlockingQueue<>(16);
    Queue<String> queue3 = new LinkedBlockingQueue<>();
    Queue<String> queue4 = new LinkedTransferQueue<>();
    Queue<String> queue5 = new PriorityQueue<>();
    Queue<String> queue6 = new SynchronousQueue<>();
    Queue<String> queue7 = new ConcurrentLinkedQueue<>();
    Queue<String> queue8 = new ConcurrentLinkedDeque<>();
    Queue<String> queue9 = new LinkedBlockingDeque<>();
    Queue<Delayed> queue10 = new DelayQueue<>();



    /**
     * stack
     */
    Stack<String> stack1 = new Stack<>();

    /**
     * map
     */
    Map<String,String> map1 = new HashMap<>();
    Map<String,String> map2 = new Hashtable<>();
    Map<String,String> map3 = new LinkedHashMap<>();
    Map<String,String> map5 = new ConcurrentHashMap<>();
    Map<String,String> map6 = new TreeMap<>();
    Map<String,String> map7 = new WeakHashMap<>();
    Map<String,String> map8 = new IdentityHashMap<>();

    public static void main(String[] args) {
        Map<Jone,Jone> map1 = new HashMap<>();
        Jone jone1 = new Jone();
        jone1.name="jone1";
        jone1.age="10";
        Jone jone11 = new Jone();
        jone11.name="jone1";
        jone11.age="10";
        Jone jone12 = new Jone();
        jone12.name="jone1";
        jone12.age="10";

        Jone jone2 = new Jone();
        jone2.name="jone2";
        jone2.age="11";

        Jone jone3 = new Jone();
        jone3.name="jone3";
        jone3.age="12";

        map1.put(jone1,jone2);
        map1.put(jone11,jone3);
        map1.put(jone12,jone3);
        Iterator<Jone> iterator = map1.keySet().iterator();

        while (iterator.hasNext()){
            Jone next = iterator.next();
            System.out.println(next+","+next.name);
        }
    }

}


class DelayImpl implements Delayed{

    @Override
    public long getDelay(TimeUnit unit) {
        return 0;
    }

    @Override
    public int compareTo(Delayed o) {
        return 0;
    }
}
